javascript - Trying to edit a message that is displayed by innerHTML -


i trying edit welcome message have site using css. have message displays if first time user vists site , if repeat user using cookies. trying edit message div using css. here javascript code picks message display using cookies:

window.onload = function welcomemessage(){	  		var visitdata = decodeuricomponent(document.cookie);  		if (visitdata.length == 0)  			document.getelementbyid('welcome').innerhtml = "<h4>welcome our website!</h4>";  		else  			document.getelementbyid('welcome').innerhtml = "<h4>welcome our website. please browse site learn our services.</h4>";  		var expiresdate = new date();  		expiresdate.setfullyear(expiresdate.getfullyear() - 1);  		document.cookie = encodeuricomponent("expires=" + expiresdate.toutcstring());  	}

i have message displayed on html:

<div id="welcome"></div> 

i use css align text , possibly more add border. reason when try use css file style won't work on div. don't know if because function uses innerhtml or what. new javascript advice helpful. in advance.

you can directly give style attributes 'welcome' id. no need give javascript.

eg.

<style> #welcome {     border-style: solid;     border-color: #ff0000 #0000ff; } </style> 

by js can follow way:

<script> document.getelementbyid("welcome").style.color = "blue"; </script> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -