Dreamweaver \ HTML problem

I'm building my website, using Dreamweaver CS3, I used to work on CS3 and I used the Behavior panel to code.


In CS2, in the "change properties" window, there was a in "innerHTML" option that let me change the content of a DIV to whatever I wanted it to be, writing a code that looked something like this: <a href="#" onclick="MM_changeProp('newsphoto','','innerHTML','&lt;img src=\&quot;images/cal/Jan0501.jpg\&quot;&gt;','DIV')">Print Zero Exchange #5 </a>


Sadly, when I tried using CS3 to do the same thing, I noticed that the innerHTML option was canceled, and trying to write the code by myself or coping it from another page failed.


Is there a different way to code this now? why isn't it working? what do I need to change?


  • 638 views
Share Send to a friend Watch Report
 

Best Answer

 

The code to do it manually is actually quite simple.  First, set up your target element with an ID, like this:

 <div id="mytarget"></div>

Note that it doesn't have to be a DIV element if you don't need that, a SPAN or a P will work just the same.  The ID can be anything you want, just no spaces and it needs to be unique on your page.

Now your onclick event needs to be something like this:

 onclick="document.getElementById('mytarget').innerHTML = 'Text inserted using on click'; return false;"

The 'mytarget' has to correspond with the ID you used on your element above.  Common gotchas are getting the quotes wrong, which may not be clear above.  In the above example, because double quotes (") are used to wrap the onclick attribute, single quotes (') need to be used as string delimiters inside the onclick.  The 'return false' at the end stops the '#' link being followed, which you may or may not want.

Finally, I should point out this sort of thing is acceptable for one off use if you're quickly knocking something together or are only doing a small amount of manipulation, but the correct (W3C) method for doing this sort of thing is to create and append DOM elements, but this is a little more complex in the simple case.  Have a read of this article for explanations and alternatives to innerHTML, you might also take a look at a javascript library like jQuery which makes that sort of manipulation easier.


Posted 1 year ago ( permalink )
In reply to lilly's question
robertc was invited by Yedda to answer this question.

Rated as
Best Answer
0
4

Helpful?

line
line
line


 

All Answers

 

Thanks! Actually just phrasing the question was a big help, I started checking out some support forums and solved it shortly after I posted the question.

 


Posted 1 year ago ( permalink )
Rated as
#2 out of 2
0
0

Helpful?

line
line
line



Sign in to participate

Got an answer for lilly? Would you like to comment on the posted answers, or vote for the one which you think is the best?

Sign up for a free account, or sign in (if you're already a member).

Explore Related Questions

Other people asked questions on similar topics, check out the answers they received:


Hello, how to search HTML code in google?

Hello, I want to findout about websites which they have ONLY this html code: <h1>My keyword</h1> Is there anybody knows that how ...
Submitted by Paris_dxb 9 months ago
  • viewed 515 times

Last answer posted 7 months ago by robertc


Website resolutions, Whats next?

is 800x600 websites dead? should i start doing 1024 websites?
Submitted by aloncarmel2k 2 years ago
  • viewed 1257 times

Last answer posted 2 years ago by chinchpokli


How many websites exists in the U.S?

How many websites exists in the U.S? How many of those websites have member-based section that require login?
Submitted by itye 9 months ago
  • viewed 861 times

Last answer posted 8 months ago by C



» More...

Explore Related Posts in Forums

Can a GUI be coded entirely in HTML?

and if possible links to tools/software available that can help generate the HTML code. Thanks a lot . Will it be possible to code the entire GUI in HTML? I would like to get some feedback from GUI experts on this topic

Embed HTML Code Into Mail?

(free app) or just publish your html document to the internet (either using ... You can do it, but it will not be the easiest thing, and it's generally frowned on, since ...

Flash file that can load an external html file from a webpage on the...

I've got the file that can load a html file relative to the swf with code as below: dataXML = new XML Hi there, I have been searching for a Flash file that can load an external html file from a webpage
» More...
Powered by
Feed - Subscribe to changes to this Q&A Blog

Explore Related Videos

Blue Marble 1212 nr. 6

Dit is Blue Marble. Help ons het mysterie op te lossen. Mission 1212 is een reeks van zes video's die een serie aanwijzingen bevatten. Het oplossen van deze aanwijzingen draagt zowel bij aan het succes van de missie als aan jouw persoonlijke succes. Agent Blue Marble heeft jouw hulp nodig om de code te kraken. Er is iets mysterieus aan de hand, iets groots, maar wat is het? Waarom wordt Blue Marble gecontroleerd door het Departement voor de Europese Veiligheid? Waarom beweegt hij zich door Europa en achtervolgt hij schaduwen? Je zult betrokken moeten raken om dit uit te vinden. Alle video's moeten in de juiste volgorde bekeken worden om te code te kunnen kraken. Wanneer je dit gelukt is maak je kans op het winnen van de ultieme prijs: tickets voor twee personen naar een VIP film première in London, inclusief vluchten en twee nachten in een top hotel. Om alle zes de video's te kunnen zien en om deel te kunnen nemen aan het spel ga je naar www.mission1212.com Helaas kunnen we slechts een tipje van de sluier oplichten over het doel van dit alles. Maar als je een fan ben van klassieke science fiction dan zul je erg benieuwd zijn naar wat hier achter zit. Gesponsorde video, klik hier om te winnen!

Great American History Quiz: Code Talkers

America at War: Maury Povich on Native American code talkers used in WWII.

Code Geass amv

Song: The Fray - How to save a life Anime: Code Geass Warning: Spoiler series end This is my first AMV and I know it sucks. But I still hope that you like it. This AMV is purely a fan made video. I do not own Code Geass and song.

zombie shooter code and bittorrent turbo code

zombie shooter code and bittorrent turbo code codes in video

Official Animal Crossing: City Folk FRIEND...

POST YOUR FRIEND CODE! Fox will be adding the first people that post, so please post your friend code! and I will add you! Share with others too, because we will be able to create a community!

free rider 2 glitches - with code!

me doing some glitches in free rider 2 code = -18 1i 18 1i,13 1h 8g 1k,a5 t as u bm v ci 10 de 13 ea 1c ff 1r ge 2d hc 39 i7 49 ir 5e iv 6l in 7s ht 93 gk a4 fc ap dv bc ci br b5 c7 9g cg 7r co 62 d2 47 db 2c dm h e1,a5 t 2q p,m dv -b e6 -1i eb -2o ef -40 eh -5a eg -6j eb -7q e1 -8v dh -a1 cs -at bv -bm aq -cf 9m -d6 8b -di 6s -dl 5e -dh 42 -d6 2p -cg 1m -bl h -am -d -9n -14,-16 1j -45 1h,-4s -9 -42 -9 -42 -17,-4p -6 -55 -o,2s 5b 2q 54,-53 -q -44 -16,-23 2o -26 2m##B 71 16 32,B 5f 14 2q,B 3n 12 2q

Baby Ryan - 6 Days Old obviously smiling,...

Baby Ryan - 6 Days Old obviously smiling, and explanation of Code 1 and 2 - 10-31-08 422pm

Resident Evil Code Veronica X - A Sigh of...

This is such tranquil music, this is from Resident Evil Code Veronica X... the pic is from the bundle pack for the PS2 containing Resident Evil: Outbreak, Code Veronica X, and Resident Evil 4.

Code Geass: Lelouch of the Rebellion 1st...

Code Geass: Lelouch of the Rebellion 1st Opening Anime Version 2
» More...
Powered by