get获取网页 document

get获取网页 document,第1张

我这里有源代码,usingSystem;usingSystemCollectionsGeneric;usingSystemComponentModel;usingSystemData;usingSystemDrawing;usingSystemLinq;usingSystemText;usingSystemWindowsForms;usingSystemTextRegularExpressions;usingSystemNet;namespaceDownPic{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatestaticInt64i=0;publicstaticstring[]GetHtmlImageUrlList(stringsHtmlText){//定义正则表达式用来匹配img标签RegexregImg=newRegex(@"]\bsrc[\s\t\r\n]=[\s\t\r\n][""'][\s\t\r\n]([^\s\t\r\n""'])[^]/[\s\t\r\n]>",RegexOptionsIgnoreCase);//搜索匹配的字符串MatchCollectionmatches=regImgMatches(sHtmlText);//inti=0;string[]sUrlList=newstring[matchesCount];//取得匹配项列表foreach(Matchmatchinmatches)sUrlList[i++]=matchGroups["imgUrl"]Value;returnsUrlList;}privatevoidbutton1_Click(objectsender,EventArgse){if(folderBrowserDialog_CShowDialog()==DialogResultOK){textBox_CText=folderBrowserDialog_CSelectedPath;if(textBox_CTextLength>3){textBox_CText=textBox_CText+"\\";}}}privatestringresult=null;privatestringstyle(){stringchoose=null;if(radioButton_jpgChecked){choose=radioButton_jpgText;}elseif(radioButton_pngChecked){choose=radioButton_pngText;}return""+choose;}privatestaticInt64k=1;privatevoidbutton2_Click(objectsender,EventArgse){try{WebClientclient=newWebClient();clientEncoding=SystemTextASCIIEncodingUTF8;result=clientDownloadString(textBox_urlText);}catch(Exceptionex){MessageBoxShow("请输入地址!","警告",MessageBoxButtonsOK,MessageBoxIconWarning);}richTextBox_resourceText=result;try{RegexregImg=newRegex(@"]+src=\s(:'([^']+)'|""([^""]+)""|([^>\s]+))\s[^>]>",RegexOptionsIgnoreCase);string[]s=GetHtmlImageUrlList(result);string[]filepath=newstring[sLength];for(Int64j=0;j

iframe:

content: '<iframe id="iframe1" src="" style="" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>'

方法:

var a = documentgetElementById('iframe1')contentWindowdocumentgetElementById('a)value; //输入值

var a= documentgetElementById('iframe1')contentWindowdocumentgetElementById('a')defaultValue; //默认值

如果是获取表单里的变量的值,可以这样获得:

documentforms['form的名字']elements['show11']value;

--但细看你提供的代码里,没有 表单的标记 form 标记

以上就是关于get获取网页 document全部的内容,包括:get获取网页 document、在163邮箱登录界面,怎么用js从frame里的document获取文本框、document如何通过name获取表单的value等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9765096.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-01
下一篇2023-05-01

发表评论

登录后才能评论

评论列表(0条)

    保存