ckrudelux Posted September 13, 2009 Share Posted September 13, 2009 Okay I have this function which checks some stuff in a textarea. This should happen then I press submit.I tested to add a submit line to the function but no luck. <a class="plink" title="Lägg till en paragraph" href="" onclick="checktags(); return false;">Lägg till paragraf</a> function checktags(){ if(document.getElementById(b).style.backgroundImage == "url(pageparts/bt.png)"){ document.getElementById('2052420').value += "[/b]"; document.getElementById(b).style.backgroundImage = "url(pageparts/bf.png)"; } if(document.getElementById(u).style.backgroundImage == "url(pageparts/ut.png)"){ document.getElementById('2052420').value += "[/u]"; document.getElementById(u).style.backgroundImage = "url(pageparts/uf.png)"; } if(document.getElementById(u).style.backgroundImage == "url(pageparts/ut.png)"){ document.getElementById('2052420').value += "[/u]"; document.getElementById(u).style.backgroundImage = "url(pageparts/uf.png)"; } if(document.getElementById(l).style.backgroundImage == "url(pageparts/lt.png)"){ document.getElementById('2052420').value += "[/l]"; document.getElementById(l).style.backgroundImage = "url(pageparts/lf.png)"; } if(document.getElementById(c).style.backgroundImage == "url(pageparts/ct.png)"){ document.getElementById('2052420').value += "[/c]"; document.getElementById(c).style.backgroundImage = "url(pageparts/cf.png)"; } if(document.getElementById(r).style.backgroundImage == "url(pageparts/rt.png)"){ document.getElementById('2052420').value += "[/r]"; document.getElementById(r).style.backgroundImage = "url(pageparts/rf.png)"; } document.getElementById('pform').submit(); } What is wrong ? Link to comment Share on other sites More sharing options...
Ingolme Posted September 13, 2009 Share Posted September 13, 2009 The style.backgroundImage property is empty because the element itself doesn't have a style attribute. Link to comment Share on other sites More sharing options...
ckrudelux Posted September 13, 2009 Author Share Posted September 13, 2009 The style.backgroundImage property is empty because the element itself doesn't have a style attribute.Say what.. I don't have a problem with what.. I was just wondering if my code for submiting the form in the function how I make it to work!? Link to comment Share on other sites More sharing options...
Ingolme Posted September 13, 2009 Share Posted September 13, 2009 Form... Hmm, the code for submitting the form is correct. Does the 'pform' object exist? And does it have any onsubmit handler that's stopping it from being submit? Link to comment Share on other sites More sharing options...
ckrudelux Posted September 13, 2009 Author Share Posted September 13, 2009 Form... Hmm, the code for submitting the form is correct. Does the 'pform' object exist? And does it have any onsubmit handler that's stopping it from being submit?Yes it does onsubmit no.. Well I thought seens I got the link sending the submit at the beginning I thought I could send it to a function instead and submiting from there. Link to comment Share on other sites More sharing options...
ckrudelux Posted September 13, 2009 Author Share Posted September 13, 2009 Okay I found 1 problem I had forgot to add " " for getElementById("u") instead of getElementById(u) but I can still not submit.Edit: Okat it works know but I don't get it why it takes so many reloads before it takes the new code ? Link to comment Share on other sites More sharing options...
ckrudelux Posted September 14, 2009 Author Share Posted September 14, 2009 Does anyone know any good script for editing textareas where selection have been made or how long it is? Link to comment Share on other sites More sharing options...
heldplayer Posted September 23, 2009 Share Posted September 23, 2009 the first line of the script: document.getElementById([b]"[/b]b[b]"[/b]) Link to comment Share on other sites More sharing options...
ckrudelux Posted September 23, 2009 Author Share Posted September 23, 2009 the first line of the script:document.getElementById([b]"[/b]b[b]"[/b]) What?? Link to comment Share on other sites More sharing options...
Ingolme Posted September 23, 2009 Share Posted September 23, 2009 What??He meant this:document.getElementById("b") The BBCode wasn't parsed because it was between tags.You need to put quotes around the ID every time you call the getElementById function. Link to comment Share on other sites More sharing options...
heldplayer Posted September 24, 2009 Share Posted September 24, 2009 sorry, I forgot that the bold tag don't works in code-tags Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.