/    Sign up×
Community /Pin to ProfileBookmark

simple onclick safari problem

any reason why this will not work in safari?

[CODE]imageDIV.innerHTML+=”<p class=’descriptionText’><b class=’subject’>Video Demo: </b><a class=’pink’ onclick=’loadVid(new Video(“”+videoTAG+””));’>click here</a></p>”[/CODE]

i even tried to make the onclick a simple alert:

[CODE]imageDIV.innerHTML+=”<p class=’descriptionText’><b class=’subject’>Video Demo: </b><a class=’pink’ onclick=’alert(“hello”)’>click here</a></p>”[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@CrazyMerlinJul 15.2007 — don't know safari at all, but you could build it via DOM instead of using innerHTML:

<i>
</i>
var para = document.createElement('p');
para.className = 'descriptionText';

var bold = document.createElement('b');
bold.className = 'subject';

var title = document.createTextNode('Video Demo: ');
bold.appendChild(title);

var link = document.createElement('a');
link.class = 'pink';
link.onclick = function(videoTAG)
{
loadVid(new Video("'" + videoTAG + "'"));
};

var link_title = document.createTextNode('click here');
link.appendChild(link_title)

para.appendChild(bold);
para.appendChild(link);

imageDIV.appendChild(para);


haven't tested it though
Copy linkTweet thisAlerts:
@mlechoauthorJul 24.2007 — yeah....thanks crazyMerlin....DOM is right
×

Success!

Help @mlecho spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...