简体   繁体   中英

Edit JavaScript Object

I have the following javascript object :

Note: I'm copying this from my browsers console

Object
content: "http://localhost/abito/website/secondary_imgs.php?imgId=18&imgTitle=Hugo%20Boss%20Sweat-Top%20-%20Skaz%20in%20Grey&mWidth=593&mHeight=900"
gallery: "New Arrivals"
link: HTMLAnchorElement
options: Object
player: "iframe"
title: "Hugo Boss Sweat-Top - Skaz in Grey(front)"
__proto__: Object

It is being created by the plugin Shadowbox.js, so I have no control over it's creation.

My question is, is there any way I can edit the content part of the Object , and then place it back in the Object ?

The Object is already referenced to the variable c . I am able to reference the content with the following: var url = c.content . What I am unsure of is how to edit the content , and then place it back inside the object for use.

Thanks in advance for any help you can provide.

if c refers to the object, then you simply need to assign a different value to the properties you want to change, like this.

c.content = 'what you want';
c.gallery = 'new gallery';

etc. But I'm not sure what you will be able to achieve with this anyway, it all depends on how and when those values are being read.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM