Jump to content

Need Some Help Again.. :p


ckrudelux

Recommended Posts

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

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

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

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

  • 2 weeks later...
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...