Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML - CSS Refresh Problem - Loosing Styles on Repainting a Page

Status
Not open for further replies.

rgajapathi

Technical User
Aug 13, 2003
2
US
Hello FellowCoders!

I am stuck w/ this problem and I am not sure how to proceed. I have a HTML form and I am also using Struts with it and a CSS. The Submit Button according to the Standards that we have cannot be implemented as a <Input type=&quot;Submit&quot;>. However, using the CSS and standards, I have to implement as an Anchor with images of a Submit and Reset Button. The Since I am using Struts, we use a function to evaluate if the mandatory fields are filled or not.
The page on opening looks perfect uses the CSS. When I click on submit, the function is invoked and message is displayed. However, I loose all my formatting and the fields and texts and labels are displayed without any of the color formatting provided. The sample code is:
<html:html locale=&quot;true&quot;>
<head>
<title><bean:message key=&quot;enterClaimForm.title&quot;/></title>
<link rel=&quot;stylesheet&quot; href=&quot;portal/styles/Style.css&quot; type=&quot;text/css&quot;>
<script language=&quot;JavaScript&quot; src=&quot;portal/javascript/jsfunc.js&quot;></script>
<script language=&quot;JavaScript&quot; src=&quot;javascript/utility.js&quot;></script>
<script language=&quot;JavaScript&quot;>
function changeButtonImages(id, action) {
if ( action == &quot;over&quot; ) {
//set the style class of the dynamic buttons to Over State
document.getElementById( id + 'Head').className = &quot;buttonOverHead&quot;
document.getElementById( id + 'Body').className = &quot;buttonOverBody&quot;
document.getElementById( id + 'Tail').className = &quot;buttonOverTail&quot;
}
else if ( action ==&quot;clickon&quot;) {
//set the style class of the dynamic buttons to Clickon State
document.getElementById( id + 'Head').className = &quot;buttonClickonHead&quot;
document.getElementById( id + 'Body').className = &quot;buttonClickonBody&quot;
document.getElementById( id + 'Tail').className = &quot;buttonClickonTail&quot;
}
else if ( action ==&quot;regular&quot;) {
//set the style class of the dynamic buttons to Regular State
document.getElementById( id + 'Head').className = &quot;buttonRegHead&quot;
document.getElementById( id + 'Body').className = &quot;buttonRegBody&quot;
document.getElementById( id + 'Tail').className = &quot;buttonRegTail&quot;
}
}
function init() {
document.getElementById('submitHead').className = &quot;buttonRegHead&quot;
document.getElementById('submitBody').className = &quot;buttonRegBody&quot;
document.getElementById('submitTail').className = &quot;buttonRegTail&quot;
document.getElementById('resetHead').className = &quot;buttonRegHead&quot;
document.getElementById('resetBody').className = &quot;buttonRegBody&quot;
document.getElementById('resetTail').className = &quot;buttonRegTail&quot;
}
<html:base/>
</head>
<body bgcolor=&quot;white&quot; onLoad=&quot;init()&quot;>

<html:errors/>

<html:form action=&quot;/EnterClaim&quot; focus=&quot;phoneNumber&quot; onsubmit=&quot;return validateClaimForm(this);&quot;>
............
............
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td id=&quot;submitHead&quot;> </td>
<td id=&quot;submitBody&quot; align=center>
<a class=&quot;buttonLabel&quot; href=&quot;#&quot;
onClick=&quot;javascript:validateClaimForm(document.claimForm);&quot;
onMouseOver=&quot;changeButtonImages('submit', 'over')&quot;
onMouseOut=&quot;changeButtonImages('submit', 'regular')&quot;
onMouseDown=&quot;changeButtonImages('submit', 'clickon')&quot;
onMouseUp=&quot;changeButtonImages('submit', 'regular')&quot;>Submit
</a>
</td>
<td id=&quot;submitTail&quot;> </td>
<td class = buttonSpace> </td>
<td id=&quot;resetHead&quot;> </td>
<td id=&quot;resetBody&quot; align=center>
<a class=&quot;buttonLabel&quot; href=&quot;javascript:document.forms[0].reset();&quot;
onMouseOver=&quot;changeButtonImages('reset', 'over')&quot;
onMouseOut=&quot;changeButtonImages('reset', 'regular')&quot;
onMouseDown=&quot;changeButtonImages('reset', 'clickon')&quot;
onMouseUp=&quot;changeButtonImages('reset', 'regular')&quot;>Reset
</a>
</td>
<td id=&quot;resetTail&quot;> </td>
</tr>
</table>
.........

U'r help would be very much appreciated.
TIA,
Raj.
 
Have you tested this live (online)?

I had a similar problem with this but when it went live it was fine?!?!?

Anyhow, that's all the advice I can offer

Reality is built on a foundation of dreams.
 
Thanks, currently I have only tested on my localhost. I am not sure based on what I could have this promoted. However, I will definitely give that a shot.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top