我不得不做以下解決方法:
我用Request.Browser.Browser檢查瀏覽器是否爲IE ...然後我修改了文字文字如下:
Dim s As New StringBuilder
s.Append("<iframe name='myIframe' style='visibility:hidden;height:0;width:0;'></iframe><div style='clear:both'></div><h2 class='sIFR-replaced1' style='text-align:left'><embed height='20' id='h2heading' width='282' src='swf/frutiger_light.swf' quality='best' flashvars='txt=Document Description&textalign=left&offsetTop=0&textcolor=#878787&hovercolor=#76b404&linkcolor=#87be22&w=282&h=20' wmode='transparent' bgcolor='transparent' sifr='true' type='application/x-shockwave-flash' class='sIFR-flash1' style='width: 282px; height: 20px;'/><span class='sIFR-alternate'>Document Description</span></h2><p align='left'><i>" + d.DocDescription + "</i><BR><BR></p>")
s.Append("<p>Please fill out the following information so that we can proceed with providing you the link to the document</p>")
If (Not Request.Browser.Browser.Equals("IE")) Then
s.Append("<form id='myDocForm' name='myDocForm' target='myIframe' action='" + d.DataSubmissionPath + "' method='POST' >")
End If
s.Append("<table class='clearBoth' width='45%'><tr><td>")
s.Append("<input type=hidden name='oid' id='oid' value='" + d.OID + "'></td><td>")
s.Append("<input type=hidden name='retURL' id='retURL' value='" + "" + "'></td></tr>")
' debug(info)
s.Append("<input type='hidden' name='debug' value=1>")
s.Append("<input type='hidden' name='debugEmail'")
s.Append("value=''>")
s.Append("<tr><td class='formlabel'>First Name*</td>")
s.Append("<td class='formfield'><input type='text' id='first_name' size='20' maxlength='40' name='first_name'>")
s.Append("</td></tr>")
s.Append("<tr><td class='formlabel'>Last Name*</td>")
s.Append("<td class='formfield'><input type='text' id='last_name' size='20' maxlength='40' name='last_name'>")
s.Append("</td></tr>")
s.Append("<tr><td class='formlabel'>Email*</td>")
s.Append("<td class='formfield'><input type='text' id='email' size='20' maxlength='40' name='email'>")
s.Append("</td></tr>")
s.Append("<tr><td class='formlabel'>Work Title</td>")
s.Append("<td class='formfield'><input type='text' id='work_title' size='20' maxlength='40' name='work_title'>")
s.Append("</td></tr>")
s.Append("<tr><td class='formlabel'>Company</td>")
s.Append("<td class='formfield'><input type='text' id='company' size='20' maxlength='40' name='company'>")
s.Append("</td></tr>")
s.Append("<tr><td> </td> <td></td></tr>") 'empty row for spacer cells
s.Append("<tr><td> </td><td class='formbuttons' align='right'><input type='Button' id='btnsubmit' name='btnsubmit' value='Submit' onclick='showDocPanel();'>")
s.Append("</td></tr>")
s.Append("</table>")
If (Not Request.Browser.Browser.Equals("IE")) Then
s.Append("</form>")
End If
formSalesForce.Text=s.ToString()
因此,IE瀏覽器顯示該表時,因爲在使用IE時沒有標籤附加到文字上。
現在;當使用IE瀏覽器,我有一個擔心張貼到外部網站的形式,因爲沒有形式,它無法提交...因此,我不得不使用javascript創建一個副本表單:
使用此JavaScript段從該網站採取:http://en.allexperts.com/q/Javascript-1520/create-form-submit-fly.htm
function getNewSubmitForm(){
var submitForm = document.createElement("FORM");
document.body.appendChild(submitForm);
submitForm.method = "POST";
return submitForm;
}
//helper function to add elements to the form
function createNewFormElement(inputForm, elementName, elementValue){
var newElement = document.createElement("<input name='"+elementName+"' id='" + elementName + "' type='hidden'>");
inputForm.appendChild(newElement);
newElement.value = elementValue;
return newElement;
}
//function that creates the form, adds some elements
//and then submits it
function createFormAndSubmit(){
var submitForm = getNewSubmitForm();
//alert("form created");
createNewFormElement(submitForm, "oid", document.getElementById("oid").value);
createNewFormElement(submitForm, "debug", "1");
createNewFormElement(submitForm, "debugEmail", "");
createNewFormElement(submitForm, "first_name", document.getElementById("first_name").value);
createNewFormElement(submitForm, "last_name", document.getElementById("last_name").value);
createNewFormElement(submitForm, "email", document.getElementById("email").value);
createNewFormElement(submitForm, "work_title", document.getElementById("work_title").value);
createNewFormElement(submitForm, "company", document.getElementById("company").value);
createNewFormElement(submitForm, "retURL", window.location.href);
//alert(window.location.href + "::elements added");
submitForm.action= "my external website url";
submitForm.target='myIframe';
//alert("submitting");
submitForm.submit();
}
現在有一個回發發生的歷史時提交給外部URL的形式,工作,圍繞我所做的:
- 創建一個隱藏的iframe,並追加到文字文本(參見上面的代碼爲文本文本)
- 設置形式的目標是該幀的名稱(參見上面的代碼爲文字文本)
- 設置重複的javascript形式的目標是該幀(見的JavaScript代碼以上)
的名稱
來源
2010-01-07 06:06:19
ria
請提供字面控制的內容嗎? – Himadri 2010-01-05 06:45:43
當您查看源代碼時,您是否看到'
對不起stackoverflow.com在我的最後沒有打開,所以我不能早先回復你的帖子。 @Kobi:我看不到表單,當我查看頁面的源代碼時,我知道我有兩種形式,一種是aspnet,一種是基於html的正常...但事情是,我已經得到它的工作在其他瀏覽器,但不是IE – ria 2010-01-05 07:37:45