gpt4 book ai didi

jquery - 使用 jquery 从 HTML 页面中提取名称

转载 作者:行者123 更新时间:2023-12-01 03:20:25 25 4
gpt4 key购买 nike

我的大学提供成绩卡,这真的很困惑,计算最终结果真的很困难。因为所有科目最终的权重都不同。

我正在开发一个 BCA 结果计算器。这是这个https://www.bobdn.com/IGNOU_BCA_Result.aspx

我在 div 中有以下代码(我无法更改它,因为它是从大学网站返回的)

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Grade Card</TITLE>
<h1> Grade Card </h1>
<h1>&nbsp;</h1>
(All programs Except for BIT/ADIT)

</HEAD>
<BODY bgcolor=Lavender>


<form name=FRMResult method=post action=Result.asp>
<center> <font size=+2> Indira Gandhi National Open University </font>
<br> Grade Card Status as on May 09, 2012<br> (For information only)</center>
Enrolment Number: 092853268<br> Name: SHASHWAT TRIPATHI<br> Program: BCA<p><font size=-1> The Status is indicative only & cannot be used as a substitute for the final grade card which is sent by SRE at the end of a semester.</font><br><table border=1 width='80%' background='ignou.gif'><tr><td width='10%'> Course Code </td><td width='10%' align=center> Asgn1 </td><td width='10%' align=center> Asgn2 </td><td width='10%' align=center> Asgn3 </td><td width='10%' align=center> Asgn4 </td><td width='10%'> Term End Theory </td><td width='10%'> Term End Practical</td><td width='10%'> Status </td></tr><tr><td width='5%' >BCS61</td><td width='10%' >80</td><td width='10%' >73</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >40</td><td width='10%' >67</td><td width='20%' >Completed</td></tr><tr><td width='5%' >BSHF1</td><td width='10%' >35</td><td width='10%' >35</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >41</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS5</td><td width='10%' >80</td><td width='10%' >87</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >48</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS6</td><td width='10%' >70</td><td width='10%' >67</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >59</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS60</td><td width='10%' >90</td><td width='10%' >87</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >53</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS610</td><td width='10%' >60</td><td width='10%' >60</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >48</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS611</td><td width='10%' >80</td><td width='10%' >80</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >52</td><td width='10%' >88</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS612</td><td width='10%' >70</td><td width='10%' >67</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >70</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS62</td><td width='10%' >80</td><td width='10%' >80</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >40</td><td width='10%' >91</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS63</td><td width='10%' >90</td><td width='10%' >93</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >48</td><td width='10%' >85</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS64</td><td width='10%' >59</td><td width='10%' >59</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >40</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS65</td><td width='10%' >50</td><td width='10%' >53</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >97</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS66</td><td width='10%' >80</td><td width='10%' >80</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >57</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS67</td><td width='10%' >83</td><td width='10%' >83</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >93</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS68</td><td width='10%' >63</td><td width='10%' >63</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >62</td><td width='10%' >77</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS70</td><td width='10%' >70</td><td width='10%' >67</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >45</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS71</td><td width='10%' >90</td><td width='10%' >87</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%'>-</td><td width='20%' >Not Completed</td></tr><tr><td width='5%' >FST1</td><td width='10%' >66</td><td width='10%' >66</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >73</td><td width='10%'>-</td><td width='20%' >Completed</td></tr></table><br/><font size=-1 >Not with standing the result published/declared, any case of UFM(Unfairmeans) if found will make such result null and void.</font><p>&nbsp;</p><u>Note:- Assignment 4 and TE Practical do not apply to all the courses.</u><font size=-1 color=blue><center>Disclaimer: This electronically generated information does not have any legal validity</font></center>
<P>&nbsp;</P>



<a href="javascript:history.back()">Back </a>

<!--#'include file=scroll.js-->

</BODY>
</HTML>

假设我将此代码放在 ID 为 tempDiv 的 div 中现在如何从 tempDiv 中提取学生的姓名和类(class)

另外,这是一个 jsFiddle显示来自大学的 HTML 的相关部分。

最佳答案

假设您的 html 保持不变...您可以使用以下代码

var z = $('form').html();    //grab the html
var za = z.split('<br>',4); //split using <br> tags
var name = za[3]; //the element which has the name

var purename = name.replace('Name: ',''); //replace 'Name: ' with space to get pure name
alert(purename);​ //alert it

如果 IGNOU 更改了 html,您将不得不再次编辑它。

JSFiddle Example

关于jquery - 使用 jquery 从 HTML 页面中提取名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10594558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com